package ICTCLAS.I3S.AC;

public class ICTCLAS50 {
	public enum eCodeType {
		CODE_TYPE_UNKNOWN, // type unknown
		CODE_TYPE_ASCII, // ASCII
		CODE_TYPE_GB, // GB2312,GBK,GB10380
		CODE_TYPE_UTF8, // UTF-8
		CODE_TYPE_BIG5// BIG5
	}

	/**
	 * 初始化解析器，并依据配置文件，准备分词器必要的数据
	 * 
	 * @param sPath
	 *            配置文件的路径
	 * @return 是否初始化成功
	 */
	public native boolean ICTCLAS_Init(byte[] sPath);

	public native boolean ICTCLAS_Exit();

	public native int ICTCLAS_ImportUserDictFile(byte[] sPath, int eCodeType);

	public native int ICTCLAS_SaveTheUsrDic();

	public native int ICTCLAS_SetPOSmap(int nPOSmap);

	public native boolean ICTCLAS_FileProcess(byte[] sSrcFilename,
			int eCodeType, int bPOSTagged, byte[] sDestFilename);

	/**
	 * 对文本进行分词
	 * 
	 * @param sSrc
	 *            文本字符串
	 * @param eCodeType
	 * @param bPOSTagged
	 *            0代表不标注词性
	 * @return 分词结果，以自己数组返回，每两个字节代表一个字符
	 */
	public native byte[] ICTCLAS_ParagraphProcess(byte[] sSrc, int eCodeType,
			int bPOSTagged);

	public native byte[] nativeProcAPara(byte[] sSrc, int eCodeType,
			int bPOStagged);

	/* Use static intializer */
	static {
		String path = System.getProperty("user.dir")
				+ "\\src\\com\\openess\\bigsearch\\engine\\ICTCLAS\\ICTCLAS50.dll";
		System.load(path);
	}

	public static void main(String[] args) {
		System.out.println(System.getProperty("user.dir"));
	}
}
